package com.pushmessgae.server.config;

import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.util.Properties;

public class StringValue {

private static final String filePath = "/strings.properties";
	
	private static StringValue stringValue ;
	
	private static final Properties PROPERTIES = new Properties();
	
	private StringValue(){
		load();
	}
	
	public static StringValue getInstance(){
		if(null == stringValue){
			stringValue = new StringValue();
		}
		return stringValue;
	}
	
	private void load(){
		try {
			final Reader reader = new InputStreamReader(getClass().getResourceAsStream(filePath), "UTF-8"); 
			PROPERTIES.load(reader);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	
	public String getString(String key){
		return PROPERTIES.getProperty(key);
	}
}
